/**
 * Created by yfx on 2016-10-25.
 */
import Base from './base.js';
export default class extends Base {

    async userinfoAction(){
        return this.success({username:await this.session("username")});
    }

    async  loginAction() {
        let loginRe = {};
        if(await this.session("username")=="huhu"){

        }else{
            console.log(222);
            console.log(this.http.param("username"));
            console.log(this.http.param("password"));
            if(this.http.param("username") == 'huhu' && this.http.param("password")=='111111'){
                loginRe.status = true;
                await this.session("username","huhu");
            }else{
                loginRe.status = false;
            }
        }
        return this.json(loginRe);
    }

    async  logoutAction() {
        await this.session();
        return this.json({
            status: true
        });
    }
}